﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Aribaccio.Device
{
    /// <summary>
    /// Modbus类型配置数据
    /// </summary>
    /// <typeparam name="TData">结构数据</typeparam>
    public class ModbusSlaveData<TData> : ModbusSlave where TData : struct
    {
        /// <summary>
        /// 指令数据集
        /// </summary>
        public TData SlaveData { get; set; }

        /// <summary>
        /// 默认构造函数
        /// </summary>
        public ModbusSlaveData() : base()
        {

        }

        /// <summary>
        /// 默认构造函数
        /// </summary>
        public ModbusSlaveData(ModbusSlave argModbusSlave) : this()
        {
            if (argModbusSlave != null)
            {
                base.SlaveAddress = argModbusSlave.SlaveAddress;
                base.FunctionCode = argModbusSlave.FunctionCode;
                base.RegisterAddress = argModbusSlave.RegisterAddress;
                base.CheckType = argModbusSlave.CheckType;
            }
        }

        /// <summary>
        /// 默认构造函数
        /// </summary>
        public ModbusSlaveData(ModbusSlave ModbusSlave, TData argSlaveData) : this(ModbusSlave)
        {
            this.SlaveData = argSlaveData;
        }

        
    }
}
